package com.sise.bl.dao.impl;

import com.sise.bl.dao.TypeDao;
import com.sise.bl.entity.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository(value = "typeDao")
@SuppressWarnings("all")
public class TypeDaoImpl extends BaseDaoImpl<Type> implements TypeDao {
    @Override
    public List<Type> selectAll() {
        String sql = "from Type";
        List<Type> types = find(sql);
        return types;
    }

    @Override
    public int insert(Type type) {
        int save = (int) save(type);
        return save;
    }

    @Override
    public Type selectTypeByid(Integer tid) {
        return this.getCurrentSession().get(Type.class,tid);
    }

    @Override
    public void updateType(Type type) {
        update(type);
    }
}
